import { createApp } from 'vue';
import VueWechatTitle from 'vue-wechat-title';
import 'element-plus/dist/index.css';
import App from './App.vue';
import store from './store';
import { router } from './router';
import * as ElIconModules from '@element-plus/icons-vue';
import 'default-passive-events';
import 'virtual:svg-icons-register';
import SvgIcon from '@/components/svgIcon/index.vue'; // svg component
import { getDicts } from '@/request/dict/data';

import {
    parseTime,
    resetForm,
    addDateRange,
    selectDictLabel,
    selectItemsLabel,
} from '@/utils/costum.js';
// 创建vue实例
const app = createApp(App);
app.use(store);
app.use(router);
app.use(VueWechatTitle);

app.component('SvgIcon', SvgIcon);
// 全局注册element-plus icon图标组件
Object.keys(ElIconModules).forEach((key) => {
    app.component(key, ElIconModules[key]);
});
// 全局方法挂载
app.config.globalProperties.getDicts = getDicts;
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.resetForm = resetForm;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectItemsLabel = selectItemsLabel;
// 全局指令挂载
// app.directive('permisaction', permisaction);
// 挂载实例
app.mount('#app');
